<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ice="http://www.icesoft.com/icefaces/component"   
	template="layout/template.xhtml">

	<ui:define name="body">

		<div id="banner">
			<h1>Join the Open 18 golfer community!</h1>
			<p>Already a member?#{' '}<s:link id="signin" value="Click Here to Sign In" view="/login.xhtml"/></p>
		</div>

		<h:messages id="messages" globalOnly="true" styleClass="message" errorClass="errormsg" infoClass="infomsg" warnClass="warnmsg"/>

		<ice:form id="registerActionForm" styleClass="edit">
			<ice:panelGroup id="registerPanelGroupId" styleClass="formBorderHighlight">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td class="iceDatTblColHdr2">Open 18 Member Registration</td>
					</tr>
				</table>
				
				<s:decorate id="genderField" template="layout/edit.xhtml">
					<ui:define name="label">Gender</ui:define>
					<s:div style="float: left;">
					<ice:selectOneRadio id="gender"
					      partialSubmit="true" 
					       value="#{newGolfer.gender}" 
					       styleClass="radio" required="true">
						<s:convertEnum/>
						<s:enumItem enumValue="MALE" label="Male"/>
						<s:enumItem enumValue="FEMALE" label="Female"/>
					</ice:selectOneRadio>
					</s:div>
				</s:decorate>
				<div style="clear: both;"/>
				<s:decorate id="firstNameField" template="layout/edit.xhtml">
					<ui:define name="label">First Name</ui:define>
					<ice:inputText id="firstName" value="#{newGolfer.firstName}" size="40" required="true" partialSubmit="true"/>
				</s:decorate>

				<s:decorate id="lastNameField" template="layout/edit.xhtml">
					<ui:define name="label">Last Name</ui:define>
					<ice:inputText id="lastName" value="#{newGolfer.lastName}" size="40" required="true" partialSubmit="true"/>
				</s:decorate>

				<s:decorate id="emailField" template="layout/edit.xhtml">
					<ui:define name="label">Email address</ui:define>
					<ice:inputText id="emailAddress" value="#{newGolfer.emailAddress}"
					          validator="#{registerAction.emailNotTaken}"
					             size="40" required="true" partialSubmit="true"/>
				</s:decorate>

				<s:decorate id="usernameField" template="layout/edit.xhtml">
					<ui:define name="label">Username</ui:define>
					<ice:inputText id="username" value="#{newGolfer.username}" 
					               validator="#{registerAction.validateUserName}"
					               size="20" required="true" partialSubmit="true"/>
				</s:decorate>
				
				<s:decorate id="passwordField" template="layout/edit.xhtml">
					<ui:define name="label">Password</ui:define>
					<ice:inputSecret id="password" value="#{passwordBean.password}" 
					       size="20" required="true" 
					       partialSubmit="true" redisplay="true" />
				
				</s:decorate>

				<s:decorate id="confirmField" template="layout/edit.xhtml">
					<ui:define name="label">Confirm password</ui:define>
					<ice:inputSecret id="confirm" 
					            validator="#{registerAction.confirmPassword}"
								value="#{passwordBean.confirm}" size="20" required="true" 
								redisplay="true"  
								partialSubmit="true"/> 
				</s:decorate>

				<s:decorate id="locationField" template="layout/edit.xhtml">
					<ui:define name="label">Location</ui:define>
					<ice:inputText id="location" value="#{newGolfer.location}" size="40" partialSubmit="true"/>
				</s:decorate>

				<s:decorate id="dateOfBirthField" template="layout/edit.xhtml">
					<ui:define name="label">Date of birth</ui:define>
					<ice:selectInputDate id="dateOfBirth"
					    partialSubmit="true"
					      renderAsPopup="true" 
					       value="#{newGolfer.dateOfBirth}">					       
					    <f:convertDateTime timeZone="#{timeZoneSelector.timeZone}"
					        locale="#{localeSelector.locale}"
					        dateStyle="short" type="date"/>					       
					 </ice:selectInputDate>
				</s:decorate>

				<s:decorate id="proStatusField" template="layout/edit.xhtml">
					<ui:define name="label">Pro status</ui:define>
					<h:selectOneRadio id="proStatus" value="#{newGolfer.proStatus}" styleClass="radio">
						<s:selectItems var="t" label="#{t}"
							value="#{registerAction.proStatusTypes}"/>
					</h:selectOneRadio>
				</s:decorate>

				<s:decorate id="specialtyField" template="layout/edit.xhtml">
					<ui:define name="label">Specialty</ui:define>
					<ice:selectOneMenu id="specialty"
					     partialSubmit="true" 
					      value="#{newGolfer.specialty}">
						<s:selectItems var="t" label="#{t}" 
						      noSelectionLabel="-- Select --" 
							value="#{registerAction.specialtyTypes}"/>
					</ice:selectOneMenu>
				</s:decorate>
 
				<s:decorate id="verifyCaptchaField" template="layout/edit.xhtml">
					<ui:define name="label">Security check</ui:define>
					<ui:define name="help">Please type in the letters that are shown in the image above.</ui:define>
					<h:graphicImage value="/seam/resource/captcha?nocache=#{captcha.revision}" style="width: 150px; height: 40px;"/>
					<ice:inputText id="verifyCaptcha" value="#{captcha.response}" required="true" size="20" partialSubmit="true"/>
				</s:decorate>

			</ice:panelGroup>
				<div style="clear:both">
					<span class="required">*</span> required fields
				</div>


			<div class="actionButtons">
				<ice:commandButton action="home" immediate="true" value="Cancel"/>
				<ice:commandButton id="register" value="Sign Up Now!" action="#{registerAction.register}"/>
			</div>

</ice:form>

	</ui:define>

</ui:composition>
